import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
// 路由表
// const routes = [
//   {
//     path: '/',
//     name: 'Home',
//     component: Home
//   },
//   {
//     path: '/about',
//     name: 'About',
//     // route level code-splitting
//     // this generates a separate chunk (about.[hash].js) for this route
//     // which is lazy-loaded when the route is visited.
//     component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
//   }
// ]
const routes = [ 
    {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login'),
  },
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/views/tabbar'),
    
    children: [
      {
        path: '/home',
        name: 'home', 
        component: () => import('@/views/home'),     
      },
      {
        path: '/qa',
        name: 'qa', 
        component: () => import('@/views/qa'),     
      },
      {
        path: '/my',
        name: 'my', 
        component: () => import('@/views/my'),     
      },
      {
        path: '/video',
        name: 'video', 
        component: () => import('@/views/video'),     
      },
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/search'),
  },
  {
    path: '/article/:articleId',
    name: 'article',
    component: ()=> import('@/views/article'),
    props:true
  },
  {
    path: '/chat',
    name: 'chat',
    component: ()=> import('@/views/user-chat'),
  }
]

const router = new VueRouter({
  routes
})

export default router
